package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStationEnhancedIO;

public class EnhancedIO {
    private DriverStationEnhancedIO enhancedIO;
    
    public EnhancedIO() {
        this.enhancedIO = DriverStation.getInstance().getEnhancedIO();
    }

    public void setIOState(int channel, boolean value) {
        try
        {
            enhancedIO.setDigitalOutput(channel,value); 
        }
        catch (DriverStationEnhancedIO.EnhancedIOException error)
        {
            System.out.println("BLAW: " + error);
        }
    }
    
    public boolean getIOState(int channel) {
        try
        {
            return enhancedIO.getDigital(channel);
        }
        catch (DriverStationEnhancedIO.EnhancedIOException err)
        {
            System.out.println("BLAW: " + err);
            return false;
        }
    }
}
